package com.wanxin.wb.common.support.exception;



/**
 * <B>Description:</B> 错误编码常量<br>
 * <B>Create on:</B> 2015年3月17日 下午3:51:41<br>
 *
 * @author 
 * @version 1.0
 */
public class ErrorCodeConstants {
    /*
                 编码说明：
           1 所有系统编码为1位字母+4位数字组成 ,第1位字母表示类别,后面4位数字为从1开始递增,如果数值长度不足4位,左边补0
           2 第1位字母表示类别,值为从A~Z
           A :表示系统Java级别错误，如空指针异常   ,常量命名上以 SYS_开头
           B :表示业务错误,如卖场编号不能为空的错误,常量命名上以 BIZ_开头
           C :表示系统数据库基本错误,如数据库连接不上异常,常量命名上以DB_开头
           
           目前的几种异常都存在交集,比如一个异常可能是Java异常，也可以理解为业务异常,优先级为B > C > A
           如卖场号没传：
           首先优先判断为业务异常,卖场号在这个业务中不能为空，类型为B
           如果代码中无法判断为业务异常,应该看是否能抓住判断为数据库异常,类型为C
           如果也没法判断为数据库异常，最后只能捕获为java异常,类型为A
         
           大家在使用异常时，一定要先查看是否异常存在同样的异常抛出，不要同一个错误存在两种编码，定期做CodeReview
     */

    //--------------------------------------系统错误----------------------------------------
    //位置错误
    public static final CodeDesc SYS_UNKNOWN_ERROR                     = new CodeDesc("A0000",
                                                                           "未知错误");
    //配置文件[/application.properties]不存在
    public static final CodeDesc SYS_CONFIG_FILE_NOT_EXIST             = new CodeDesc("A0001",
                                                                           "配置文件[/application.properties]不存在");
    // 配置[/application.properties]格式错误,解析失败    
    public static final CodeDesc SYS_CONFIG_FILE_PARSE_ERROR           = new CodeDesc("A0002",
                                                                           "配置[/application.properties]格式错误,解析失败");
    //Rest地址找不到
    public static final CodeDesc SYS_REST_URL_NOT_FOUND                = new CodeDesc("A0003",
                                                                           "访问的rest地址不存在");
    //3DES加密失败
    public static final CodeDesc SYS_ENCRYPT_FAILED                    = new CodeDesc("A0004",
                                                                           "3DES加密失败");

    //--------------------------------------系统错误,参数相关请求错误----------------------------------------
    public static final CodeDesc SYS_INVALIDATE_PARAMETER              = new CodeDesc("A0005",
                                                                           "无效的请求参数");
    public static final CodeDesc SYS_PARAMETER_CANT_BE_NULL            = new CodeDesc("A0006",
                                                                           "参数不能为空");

    //通用的内部错误
    public static final CodeDesc SYS_COMMON_INNER_ERROR                = new CodeDesc("A0007", "");
    public static final CodeDesc SYS_COMMON_PARAMETER_TOO_BIG          = new CodeDesc("A0008",
                                                                           "参数过长");
    public static final CodeDesc SYS_COMMON_NOT_EXISTS                 = new CodeDesc("A0009",
                                                                           "数据项不存在");
    public static final CodeDesc SYS_JSON_FORMAT_ERROR                 = new CodeDesc("A0010",
                                                                           "JSON对象格式错误");

    public static final CodeDesc FILE_NOT_EXISTS                       = new CodeDesc("A0011",
                                                                           "文件不存在");
    //--------------------------------------系统使用缓存平台组件错误----------------------------------------
    //public static final CodeDesc SYS_COMPONENT_CACHE_ERROR   = new CodeDesc("A0009", "内部错误");

    //--------------------------------------数据库错误----------------------------------------
    //通用的数据库异常处理,可以根据需要在细化不同的数据库异常信息
    public static final CodeDesc DB_DATA_ACCESS_EXCEPTION              = new CodeDesc("C0001",
                                                                           "数据库异常");

    //数据库更新异常
    public static final CodeDesc DB_DATA_UPDATE_EXCEPTION              = new CodeDesc("C0002",
                                                                           "数据库更新异常");

    //--------------------------------------业务错误信息----------------------------------------

    //行记录数据字段为空异常
    public static final CodeDesc BIZ_OBJECT_FILED_NULL_ERROR           = new CodeDesc("B0001",
                                                                           "数据字段为空");

    //库存不足
    public static final CodeDesc BIZ_NOT_ENOUGH_INVENTORY_QTY          = new CodeDesc("B0901",
                                                                           "库存不足");

    //预购库存不足
    public static final CodeDesc BIZ_NOT_ENOUGH_INVENTORY_PRE_QTY      = new CodeDesc("B0902",
                                                                           "预购库存不足");

    public static final CodeDesc BIZ_ITEM_STATUS_IS_9                  = new CodeDesc("B0903",
                                                                           "商品状态为9");

    //抽奖扣库存
    public static final CodeDesc BIZ_DEDUCTION_ITEM_IT_IN_TYPE3        = new CodeDesc("B0904",
                                                                           "抽奖扣库存商品类型不能为转单");

    public static final CodeDesc BIZ_DEDUCTION_ITEM_IT_IN_TYPE4        = new CodeDesc("B0905",
                                                                           "抽奖扣库存商品类型不能为门店");

    public static final CodeDesc BIZ_DEDUCTION_ITEM_IS_SENSITIVE       = new CodeDesc("B0906",
                                                                           "抽奖扣库存商品为敏感商品");

    public static final CodeDesc BIZ_DEDUCTION_ITEM_IS_PRE_ORD         = new CodeDesc("B0907",
                                                                           "抽奖扣库存商品为预购商品");

    //非原生卖场
    public static final CodeDesc BIZ_IS_NOT_ORGITEM                    = new CodeDesc("B0908",
                                                                           "非原生卖场");

    public static final CodeDesc GROUP_BIZ_DEDUCTION_ITEM_IT_IN_TYPE3  = new CodeDesc("B0909",
                                                                           "组团扣库存商品类型不能为转单");

    public static final CodeDesc GROUP_BIZ_DEDUCTION_ITEM_IT_IN_TYPE4  = new CodeDesc("B0910",
                                                                           "组团扣库存商品类型不能为门店");

    public static final CodeDesc GROUP_BIZ_DEDUCTION_ITEM_IS_SENSITIVE = new CodeDesc("B0912",
                                                                           "组团扣库存商品为敏感商品");

    public static final CodeDesc GROUP_BIZ_DEDUCTION_ITEM_IS_PRE_ORD   = new CodeDesc("B0913",
                                                                           "组团扣库存商品为预购商品");

    //扣库存
    public static final CodeDesc DEDUCTION_ITEM_IT_IN_TYPE3            = new CodeDesc("B0914",
                                                                           "扣库存商品类型如果为转单,则进销项税率不能为空");

    public static final CodeDesc DEDUCTION_ITEM_IT_IN_TYPE4            = new CodeDesc("B0915",
                                                                           "扣库存商品类型不能为门店");

    public static final CodeDesc DEDUCTION_ITEM_IS_SENSITIVE           = new CodeDesc("B0916",
                                                                           "扣库存商品为敏感商品");

    public static final CodeDesc DEDUCTION_ITEM_IS_PRE_ORD             = new CodeDesc("B0917",
                                                                           "扣库存商品为预购商品");

    public static final CodeDesc RETURN_ACTIVITY_ITEM                  = new CodeDesc("B0918",
                                                                           "归还商品活动库存出错,归还之后活动库存不能为负数");
    public static final CodeDesc DEDUCT_ACTIVITY_ITEM                  = new CodeDesc("B0919",
                                                                           "商品库存不足,不能扣除活动库存");
    public static final CodeDesc ACCESSORY_ITEM                        = new CodeDesc("B0920",
                                                                           "配件信息出错");
    
    public static final CodeDesc RESULT_NULL                           = new CodeDesc("B0921",
                                                                            "查询结果为空");

}
